home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gcc_260.zip / gcc_260 / gcc.info-3 (.txt) < prev    next >
GNU Info File  |  1994-07-14  |  48KB  |  925 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License" and "Protect
  13. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  14. original, and provided that the entire resulting derived work is
  15. distributed under the terms of a permission notice identical to this
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that the sections entitled "GNU General Public
  19. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  20. permission notice, may be included in translations approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: gcc.info,  Node: Optimize Options,  Next: Preprocessor Options,  Prev: Debugging Options,  Up: Invoking GCC
  23. Options That Control Optimization
  24. =================================
  25.    These options control various sorts of optimizations:
  26. `-O1'
  27.      Optimize.  Optimizing compilation takes somewhat more time, and a
  28.      lot more memory for a large function.
  29.      Without `-O', the compiler's goal is to reduce the cost of
  30.      compilation and to make debugging produce the expected results.
  31.      Statements are independent: if you stop the program with a
  32.      breakpoint between statements, you can then assign a new value to
  33.      any variable or change the program counter to any other statement
  34.      in the function and get exactly the results you would expect from
  35.      the source code.
  36.      Without `-O', the compiler only allocates variables declared
  37.      `register' in registers.  The resulting compiled code is a little
  38.      worse than produced by PCC without `-O'.
  39.      With `-O', the compiler tries to reduce code size and execution
  40.      time.
  41.      When you specify `-O', the compiler turns on `-fthread-jumps' and
  42.      `-fdefer-pop' on all machines.  The compiler turns on
  43.      `-fdelayed-branch' on machines that have delay slots, and
  44.      `-fomit-frame-pointer' on machines that can support debugging even
  45.      without a frame pointer.  On some machines the compiler also turns
  46.      on other flags.
  47. `-O2'
  48.      Optimize even more.  GNU CC performs nearly all supported
  49.      optimizations that do not involve a space-speed tradeoff.  The
  50.      compiler does not perform loop unrolling or function inlining when
  51.      you specify `-O2'.  As compared to `-O', this option increases
  52.      both compilation time and the performance of the generated code.
  53.      `-O2' turns on all optional optimizations except for loop
  54.      unrolling, function inlining, and, on machines where it interfers
  55.      with debugging, frame pointer elimination.
  56. `-O3'
  57.      Optimize yet more.  `-O3' turns on all optimizations specified by
  58.      `-O2' and also turns on the `inline-functions' option.
  59. `-O0'
  60.      Do not optimize.
  61.      If you use multiple `-O' options, with or without level numbers,
  62.      the last such option is the one that is effective.
  63.    Options of the form `-fFLAG' specify machine-independent flags.
  64. Most flags have both positive and negative forms; the negative form of
  65. `-ffoo' would be `-fno-foo'.  In the table below, only one of the forms
  66. is listed--the one which is not the default.  You can figure out the
  67. other form by either removing `no-' or adding it.
  68. `-ffloat-store'
  69.      Do not store floating point variables in registers, and inhibit
  70.      other options that might change whether a floating point value is
  71.      taken from a register or memory.
  72.      This option prevents undesirable excess precision on machines such
  73.      as the 68000 where the floating registers (of the 68881) keep more
  74.      precision than a `double' is supposed to have.  For most programs,
  75.      the excess precision does only good, but a few programs rely on the
  76.      precise definition of IEEE floating point.  Use `-ffloat-store' for
  77.      such programs.
  78. `-fno-default-inline'
  79.      Do not make member functions inline by default merely because they
  80.      are defined inside the class scope (C++ only).  Otherwise, when
  81.      you specify `-O', member functions defined inside class scope are
  82.      compiled inline by default; i.e., you don't need to add `inline'
  83.      in front of the member function name.
  84. `-fno-defer-pop'
  85.      Always pop the arguments to each function call as soon as that
  86.      function returns.  For machines which must pop arguments after a
  87.      function call, the compiler normally lets arguments accumulate on
  88.      the stack for several function calls and pops them all at once.
  89. `-fforce-mem'
  90.      Force memory operands to be copied into registers before doing
  91.      arithmetic on them.  This may produce better code by making all
  92.      memory references potential common subexpressions.  When they are
  93.      not common subexpressions, instruction combination should
  94.      eliminate the separate register-load.  I am interested in hearing
  95.      about the difference this makes.
  96. `-fforce-addr'
  97.      Force memory address constants to be copied into registers before
  98.      doing arithmetic on them.  This may produce better code just as
  99.      `-fforce-mem' may.  I am interested in hearing about the
  100.      difference this makes.
  101. `-fomit-frame-pointer'
  102.      Don't keep the frame pointer in a register for functions that
  103.      don't need one.  This avoids the instructions to save, set up and
  104.      restore frame pointers; it also makes an extra register available
  105.      in many functions.  *It also makes debugging impossible on some
  106.      machines.*
  107.      On some machines, such as the Vax, this flag has no effect, because
  108.      the standard calling sequence automatically handles the frame
  109.      pointer and nothing is saved by pretending it doesn't exist.  The
  110.      machine-description macro `FRAME_POINTER_REQUIRED' controls
  111.      whether a target machine supports this flag.  *Note Registers::.
  112. `-fno-inline'
  113.      Don't pay attention to the `inline' keyword.  Normally this option
  114.      is used to keep the compiler from expanding any functions inline.
  115.      Note that if you are not optimizing, no functions can be expanded
  116.      inline.
  117. `-finline-functions'
  118.      Integrate all simple functions into their callers.  The compiler
  119.      heuristically decides which functions are simple enough to be worth
  120.      integrating in this way.
  121.      If all calls to a given function are integrated, and the function
  122.      is declared `static', then the function is normally not output as
  123.      assembler code in its own right.
  124. `-fkeep-inline-functions'
  125.      Even if all calls to a given function are integrated, and the
  126.      function is declared `static', nevertheless output a separate
  127.      run-time callable version of the function.
  128. `-fno-function-cse'
  129.      Do not put function addresses in registers; make each instruction
  130.      that calls a constant function contain the function's address
  131.      explicitly.
  132.      This option results in less efficient code, but some strange hacks
  133.      that alter the assembler output may be confused by the
  134.      optimizations performed when this option is not used.
  135. `-ffast-math'
  136.      This option allows GCC to violate some ANSI or IEEE rules and/or
  137.      specifications in the interest of optimizing code for speed.  For
  138.      example, it allows the compiler to assume arguments to the `sqrt'
  139.      function are non-negative numbers and that no floating-point values
  140.      are NaNs.
  141.      This option should never be turned on by any `-O' option since it
  142.      can result in incorrect output for programs which depend on an
  143.      exact implementation of IEEE or ANSI rules/specifications for math
  144.      functions.
  145.    The following options control specific optimizations.  The `-O2'
  146. option turns on all of these optimizations except `-funroll-loops' and
  147. `-funroll-all-loops'.  On most machines, the `-O' option turns on the
  148. `-fthread-jumps' and `-fdelayed-branch' options, but specific machines
  149. may handle it differently.
  150.    You can use the following flags in the rare cases when "fine-tuning"
  151. of optimizations to be performed is desired.
  152. `-fstrength-reduce'
  153.      Perform the optimizations of loop strength reduction and
  154.      elimination of iteration variables.
  155. `-fthread-jumps'
  156.      Perform optimizations where we check to see if a jump branches to a
  157.      location where another comparison subsumed by the first is found.
  158.      If so, the first branch is redirected to either the destination of
  159.      the second branch or a point immediately following it, depending
  160.      on whether the condition is known to be true or false.
  161. `-fcse-follow-jumps'
  162.      In common subexpression elimination, scan through jump instructions
  163.      when the target of the jump is not reached by any other path.  For
  164.      example, when CSE encounters an `if' statement with an `else'
  165.      clause, CSE will follow the jump when the condition tested is
  166.      false.
  167. `-fcse-skip-blocks'
  168.      This is similar to `-fcse-follow-jumps', but causes CSE to follow
  169.      jumps which conditionally skip over blocks.  When CSE encounters a
  170.      simple `if' statement with no else clause, `-fcse-skip-blocks'
  171.      causes CSE to follow the jump around the body of the `if'.
  172. `-frerun-cse-after-loop'
  173.      Re-run common subexpression elimination after loop optimizations
  174.      has been performed.
  175. `-fexpensive-optimizations'
  176.      Perform a number of minor optimizations that are relatively
  177.      expensive.
  178. `-fdelayed-branch'
  179.      If supported for the target machine, attempt to reorder
  180.      instructions to exploit instruction slots available after delayed
  181.      branch instructions.
  182. `-fschedule-insns'
  183.      If supported for the target machine, attempt to reorder
  184.      instructions to eliminate execution stalls due to required data
  185.      being unavailable.  This helps machines that have slow floating
  186.      point or memory load instructions by allowing other instructions
  187.      to be issued until the result of the load or floating point
  188.      instruction is required.
  189. `-fschedule-insns2'
  190.      Similar to `-fschedule-insns', but requests an additional pass of
  191.      instruction scheduling after register allocation has been done.
  192.      This is especially useful on machines with a relatively small
  193.      number of registers and where memory load instructions take more
  194.      than one cycle.
  195. `-fcaller-saves'
  196.      Enable values to be allocated in registers that will be clobbered
  197.      by function calls, by emitting extra instructions to save and
  198.      restore the registers around such calls.  Such allocation is done
  199.      only when it seems to result in better code than would otherwise
  200.      be produced.
  201.      This option is enabled by default on certain machines, usually
  202.      those which have no call-preserved registers to use instead.
  203. `-funroll-loops'
  204.      Perform the optimization of loop unrolling.  This is only done for
  205.      loops whose number of iterations can be determined at compile time
  206.      or run time.  `-funroll-loop' implies both `-fstrength-reduce' and
  207.      `-frerun-cse-after-loop'.
  208. `-funroll-all-loops'
  209.      Perform the optimization of loop unrolling.  This is done for all
  210.      loops and usually makes programs run more slowly.
  211.      `-funroll-all-loops' implies `-fstrength-reduce' as well as
  212.      `-frerun-cse-after-loop'.
  213. `-fno-peephole'
  214.      Disable any machine-specific peephole optimizations.
  215. File: gcc.info,  Node: Preprocessor Options,  Next: Assembler Options,  Prev: Optimize Options,  Up: Invoking GCC
  216. Options Controlling the Preprocessor
  217. ====================================
  218.    These options control the C preprocessor, which is run on each C
  219. source file before actual compilation.
  220.    If you use the `-E' option, nothing is done except preprocessing.
  221. Some of these options make sense only together with `-E' because they
  222. cause the preprocessor output to be unsuitable for actual compilation.
  223. `-include FILE'
  224.      Process FILE as input before processing the regular input file.
  225.      In effect, the contents of FILE are compiled first.  Any `-D' and
  226.      `-U' options on the command line are always processed before
  227.      `-include FILE', regardless of the order in which they are
  228.      written.  All the `-include' and `-imacros' options are processed
  229.      in the order in which they are written.
  230. `-imacros FILE'
  231.      Process FILE as input, discarding the resulting output, before
  232.      processing the regular input file.  Because the output generated
  233.      from FILE is discarded, the only effect of `-imacros FILE' is to
  234.      make the macros defined in FILE available for use in the main
  235.      input.
  236.      Any `-D' and `-U' options on the command line are always processed
  237.      before `-imacros FILE', regardless of the order in which they are
  238.      written.  All the `-include' and `-imacros' options are processed
  239.      in the order in which they are written.
  240. `-idirafter DIR'
  241.      Add the directory DIR to the second include path.  The directories
  242.      on the second include path are searched when a header file is not
  243.      found in any of the directories in the main include path (the one
  244.      that `-I' adds to).
  245. `-iprefix PREFIX'
  246.      Specify PREFIX as the prefix for subsequent `-iwithprefix' options.
  247. `-iwithprefix DIR'
  248.      Add a directory to the second include path.  The directory's name
  249.      is made by concatenating PREFIX and DIR, where PREFIX was
  250.      specified previously with `-iprefix'.  If you have not specified a
  251.      prefix yet, the directory containing the installed passes of the
  252.      compiler is used as the default.
  253. `-iwithprefixbefore DIR'
  254.      Add a directory to the main include path.  The directory's name is
  255.      made by concatenating PREFIX and DIR, as in the case of
  256.      `-iwithprefix'.
  257. `-isystem DIR'
  258.      Add a directory to the beginning of the second include path,
  259.      marking it as a system directory, so that it gets the same special
  260.      treatment as is applied to the standard system directories.
  261. `-nostdinc'
  262.      Do not search the standard system directories for header files.
  263.      Only the directories you have specified with `-I' options (and the
  264.      current directory, if appropriate) are searched.  *Note Directory
  265.      Options::, for information on `-I'.
  266.      By using both `-nostdinc' and `-I-', you can limit the include-file
  267.      search path to only those directories you specify explicitly.
  268. `-undef'
  269.      Do not predefine any nonstandard macros.  (Including architecture
  270.      flags).
  271.      Run only the C preprocessor.  Preprocess all the C source files
  272.      specified and output the results to standard output or to the
  273.      specified output file.
  274.      Tell the preprocessor not to discard comments.  Used with the `-E'
  275.      option.
  276.      Tell the preprocessor not to generate `#line' commands.  Used with
  277.      the `-E' option.
  278.      Tell the preprocessor to output a rule suitable for `make'
  279.      describing the dependencies of each object file.  For each source
  280.      file, the preprocessor outputs one `make'-rule whose target is the
  281.      object file name for that source file and whose dependencies are
  282.      all the `#include' header files it uses.  This rule may be a
  283.      single line or may be continued with `\'-newline if it is long.
  284.      The list of rules is printed on standard output instead of the
  285.      preprocessed C program.
  286.      `-M' implies `-E'.
  287.      Another way to specify output of a `make' rule is by setting the
  288.      environment variable `DEPENDENCIES_OUTPUT' (*note Environment
  289.      Variables::.).
  290. `-MM'
  291.      Like `-M' but the output mentions only the user header files
  292.      included with `#include "FILE"'.  System header files included
  293.      with `#include <FILE>' are omitted.
  294. `-MD'
  295.      Like `-M' but the dependency information is written to a file made
  296.      by replacing ".c" with ".d" at the end of the input file names.
  297.      This is in addition to compiling the file as specified--`-MD' does
  298.      not inhibit ordinary compilation the way `-M' does.
  299.      In Mach, you can use the utility `md' to merge multiple dependency
  300.      files into a single dependency file suitable for using with the
  301.      `make' command.
  302. `-MMD'
  303.      Like `-MD' except mention only user header files, not system
  304.      header files.
  305. `-MG'
  306.      Treat missing header files as generated files and assume they live
  307.      in the same directory as the source file.  If you specify `-MG',
  308.      you must also specify either `-M' or `-MM'.  `-MG' is not
  309.      supported with `-MD' or `-MMD'.
  310.      Print the name of each header file used, in addition to other
  311.      normal activities.
  312. `-AQUESTION(ANSWER)'
  313.      Assert the answer ANSWER for QUESTION, in case it is tested with a
  314.      preprocessor conditional such as `#if #QUESTION(ANSWER)'.  `-A-'
  315.      disables the standard assertions that normally describe the target
  316.      machine.
  317. `-DMACRO'
  318.      Define macro MACRO with the string `1' as its definition.
  319. `-DMACRO=DEFN'
  320.      Define macro MACRO as DEFN.  All instances of `-D' on the command
  321.      line are processed before any `-U' options.
  322. `-UMACRO'
  323.      Undefine macro MACRO.  `-U' options are evaluated after all `-D'
  324.      options, but before any `-include' and `-imacros' options.
  325. `-dM'
  326.      Tell the preprocessor to output only a list of the macro
  327.      definitions that are in effect at the end of preprocessing.  Used
  328.      with the `-E' option.
  329. `-dD'
  330.      Tell the preprocessing to pass all macro definitions into the
  331.      output, in their proper sequence in the rest of the output.
  332. `-dN'
  333.      Like `-dD' except that the macro arguments and contents are
  334.      omitted.  Only `#define NAME' is included in the output.
  335. `-trigraphs'
  336.      Support ANSI C trigraphs.  The `-ansi' option also has this effect.
  337. File: gcc.info,  Node: Assembler Options,  Next: Link Options,  Prev: Preprocessor Options,  Up: Invoking GCC
  338. Passing Options to the Assembler
  339. ================================
  340. `-Wa,OPTION'
  341.      Pass OPTION as an option to the assembler.  If OPTION contains
  342.      commas, it is split into multiple options at the commas.
  343. File: gcc.info,  Node: Link Options,  Next: Directory Options,  Prev: Assembler Options,  Up: Invoking GCC
  344. Options for Linking
  345. ===================
  346.    These options come into play when the compiler links object files
  347. into an executable output file.  They are meaningless if the compiler is
  348. not doing a link step.
  349. `OBJECT-FILE-NAME'
  350.      A file name that does not end in a special recognized suffix is
  351.      considered to name an object file or library.  (Object files are
  352.      distinguished from libraries by the linker according to the file
  353.      contents.)  If linking is done, these object files are used as
  354.      input to the linker.
  355.      If any of these options is used, then the linker is not run, and
  356.      object file names should not be used as arguments.  *Note Overall
  357.      Options::.
  358. `-lLIBRARY'
  359.      Search the library named LIBRARY when linking.
  360.      It makes a difference where in the command you write this option;
  361.      the linker searches processes libraries and object files in the
  362.      order they are specified.  Thus, `foo.o -lz bar.o' searches
  363.      library `z' after file `foo.o' but before `bar.o'.  If `bar.o'
  364.      refers to functions in `z', those functions may not be loaded.
  365.      The linker searches a standard list of directories for the library,
  366.      which is actually a file named `libLIBRARY.a'.  The linker then
  367.      uses this file as if it had been specified precisely by name.
  368.      The directories searched include several standard system
  369.      directories plus any that you specify with `-L'.
  370.      Normally the files found this way are library files--archive files
  371.      whose members are object files.  The linker handles an archive
  372.      file by scanning through it for members which define symbols that
  373.      have so far been referenced but not defined.  But if the file that
  374.      is found is an ordinary object file, it is linked in the usual
  375.      fashion.  The only difference between using an `-l' option and
  376.      specifying a file name is that `-l' surrounds LIBRARY with `lib'
  377.      and `.a' and searches several directories.
  378. `-lobjc'
  379.      You need this special case of the `-l' option in order to link an
  380.      Objective C program.
  381. `-nostartfiles'
  382.      Do not use the standard system startup files when linking.  The
  383.      standard libraries are used normally.
  384. `-nostdlib'
  385.      Do not use the standard system libraries and startup files when
  386.      linking.  Only the files you specify will be passed to the linker.
  387.      One of the standard libraries bypassed by `-nostdlib' is
  388.      `libgcc.a', a library of internal subroutines that GNU CC uses to
  389.      overcome shortcomings of particular machines, or special needs for
  390.      some languages.  (*Note Interfacing to GNU CC Output: Interface,
  391.      for more discussion of `libgcc.a'.) In most cases, you need
  392.      `libgcc.a' even when you want to avoid other standard libraries.
  393.      In other words, when you specify `-nostdlib' you should usually
  394.      specify `-lgcc' as well.  This ensures that you have no unresolved
  395.      references to internal GNU CC library subroutines.  (For example,
  396.      `__main', used to ensure C++ constructors will be called; *note
  397.      `collect2': Collect2..)
  398. `-static'
  399.      On systems that support dynamic linking, this prevents linking
  400.      with the shared libraries.  On other systems, this option has no
  401.      effect.
  402. `-shared'
  403.      Produce a shared object which can then be linked with other
  404.      objects to form an executable.  Only a few systems support this
  405.      option.
  406. `-symbolic'
  407.      Bind references to global symbols when building a shared object.
  408.      Warn about any unresolved references (unless overridden by the
  409.      link editor option `-Xlinker -z -Xlinker defs').  Only a few
  410.      systems support this option.
  411. `-Xlinker OPTION'
  412.      Pass OPTION as an option to the linker.  You can use this to
  413.      supply system-specific linker options which GNU CC does not know
  414.      how to recognize.
  415.      If you want to pass an option that takes an argument, you must use
  416.      `-Xlinker' twice, once for the option and once for the argument.
  417.      For example, to pass `-assert definitions', you must write
  418.      `-Xlinker -assert -Xlinker definitions'.  It does not work to write
  419.      `-Xlinker "-assert definitions"', because this passes the entire
  420.      string as a single argument, which is not what the linker expects.
  421. `-Wl,OPTION'
  422.      Pass OPTION as an option to the linker.  If OPTION contains
  423.      commas, it is split into multiple options at the commas.
  424. `-u SYMBOL'
  425.      Pretend the symbol SYMBOL is undefined, to force linking of
  426.      library modules to define it.  You can use `-u' multiple times with
  427.      different symbols to force loading of additional library modules.
  428. File: gcc.info,  Node: Directory Options,  Next: Target Options,  Prev: Link Options,  Up: Invoking GCC
  429. Options for Directory Search
  430. ============================
  431.    These options specify directories to search for header files, for
  432. libraries and for parts of the compiler:
  433. `-IDIR'
  434.      Append directory DIR to the list of directories searched for
  435.      include files.
  436. `-I-'
  437.      Any directories you specify with `-I' options before the `-I-'
  438.      option are searched only for the case of `#include "FILE"'; they
  439.      are not searched for `#include <FILE>'.
  440.      If additional directories are specified with `-I' options after
  441.      the `-I-', these directories are searched for all `#include'
  442.      directives.  (Ordinarily *all* `-I' directories are used this way.)
  443.      In addition, the `-I-' option inhibits the use of the current
  444.      directory (where the current input file came from) as the first
  445.      search directory for `#include "FILE"'.  There is no way to
  446.      override this effect of `-I-'.  With `-I.' you can specify
  447.      searching the directory which was current when the compiler was
  448.      invoked.  That is not exactly the same as what the preprocessor
  449.      does by default, but it is often satisfactory.
  450.      `-I-' does not inhibit the use of the standard system directories
  451.      for header files.  Thus, `-I-' and `-nostdinc' are independent.
  452. `-LDIR'
  453.      Add directory DIR to the list of directories to be searched for
  454.      `-l'.
  455. `-BPREFIX'
  456.      This option specifies where to find the executables, libraries,
  457.      include files, and data files of the compiler itself.
  458.      The compiler driver program runs one or more of the subprograms
  459.      `cpp', `cc1', `as' and `ld'.  It tries PREFIX as a prefix for each
  460.      program it tries to run, both with and without `MACHINE/VERSION/'
  461.      (*note Target Options::.).
  462.      For each subprogram to be run, the compiler driver first tries the
  463.      `-B' prefix, if any.  If that name is not found, or if `-B' was
  464.      not specified, the driver tries two standard prefixes, which are
  465.      `/usr/lib/gcc/' and `/usr/local/lib/gcc-lib/'.  If neither of
  466.      those results in a file name that is found, the unmodified program
  467.      name is searched for using the directories specified in your
  468.      `PATH' environment variable.
  469.      `-B' prefixes that effectively specify directory names also apply
  470.      to libraries in the linker, because the compiler translates these
  471.      options into `-L' options for the linker.  They also apply to
  472.      includes files in the preprocessor, because the compiler
  473.      translates these options into `-isystem' options for the
  474.      preprocessor.  In this case, the compiler appends `include' to the
  475.      prefix.
  476.      The run-time support file `libgcc.a' can also be searched for using
  477.      the `-B' prefix, if needed.  If it is not found there, the two
  478.      standard prefixes above are tried, and that is all.  The file is
  479.      left out of the link if it is not found by those means.
  480.      Another way to specify a prefix much like the `-B' prefix is to use
  481.      the environment variable `GCC_EXEC_PREFIX'.  *Note Environment
  482.      Variables::.
  483. File: gcc.info,  Node: Target Options,  Next: Submodel Options,  Prev: Directory Options,  Up: Invoking GCC
  484. Specifying Target Machine and Compiler Version
  485. ==============================================
  486.    By default, GNU CC compiles code for the same type of machine that
  487. you are using.  However, it can also be installed as a cross-compiler,
  488. to compile for some other type of machine.  In fact, several different
  489. configurations of GNU CC, for different target machines, can be
  490. installed side by side.  Then you specify which one to use with the
  491. `-b' option.
  492.    In addition, older and newer versions of GNU CC can be installed side
  493. by side.  One of them (probably the newest) will be the default, but
  494. you may sometimes wish to use another.
  495. `-b MACHINE'
  496.      The argument MACHINE specifies the target machine for compilation.
  497.      This is useful when you have installed GNU CC as a cross-compiler.
  498.      The value to use for MACHINE is the same as was specified as the
  499.      machine type when configuring GNU CC as a cross-compiler.  For
  500.      example, if a cross-compiler was configured with `configure
  501.      i386v', meaning to compile for an 80386 running System V, then you
  502.      would specify `-b i386v' to run that cross compiler.
  503.      When you do not specify `-b', it normally means to compile for the
  504.      same type of machine that you are using.
  505. `-V VERSION'
  506.      The argument VERSION specifies which version of GNU CC to run.
  507.      This is useful when multiple versions are installed.  For example,
  508.      VERSION might be `2.0', meaning to run GNU CC version 2.0.
  509.      The default version, when you do not specify `-V', is controlled
  510.      by the way GNU CC is installed.  Normally, it will be a version
  511.      that is recommended for general use.
  512.    The `-b' and `-V' options actually work by controlling part of the
  513. file name used for the executable files and libraries used for
  514. compilation.  A given version of GNU CC, for a given target machine, is
  515. normally kept in the directory `/usr/local/lib/gcc-lib/MACHINE/VERSION'.
  516.    Thus, sites can customize the effect of `-b' or `-V' either by
  517. changing the names of these directories or adding alternate names (or
  518. symbolic links).  If in directory `/usr/local/lib/gcc-lib/' the file
  519. `80386' is a link to the file `i386v', then `-b 80386' becomes an alias
  520. for `-b i386v'.
  521.    In one respect, the `-b' or `-V' do not completely change to a
  522. different compiler: the top-level driver program `gcc' that you
  523. originally invoked continues to run and invoke the other executables
  524. (preprocessor, compiler per se, assembler and linker) that do the real
  525. work.  However, since no real work is done in the driver program, it
  526. usually does not matter that the driver program in use is not the one
  527. for the specified target and version.
  528.    The only way that the driver program depends on the target machine is
  529. in the parsing and handling of special machine-specific options.
  530. However, this is controlled by a file which is found, along with the
  531. other executables, in the directory for the specified version and
  532. target machine.  As a result, a single installed driver program adapts
  533. to any specified target machine and compiler version.
  534.    The driver program executable does control one significant thing,
  535. however: the default version and target machine.  Therefore, you can
  536. install different instances of the driver program, compiled for
  537. different targets or versions, under different names.
  538.    For example, if the driver for version 2.0 is installed as `ogcc'
  539. and that for version 2.1 is installed as `gcc', then the command `gcc'
  540. will use version 2.1 by default, while `ogcc' will use 2.0 by default.
  541. However, you can choose either version with either command with the
  542. `-V' option.
  543. File: gcc.info,  Node: Submodel Options,  Next: Code Gen Options,  Prev: Target Options,  Up: Invoking GCC
  544. Hardware Models and Configurations
  545. ==================================
  546.    Earlier we discussed the standard option `-b' which chooses among
  547. different installed compilers for completely different target machines,
  548. such as Vax vs. 68000 vs. 80386.
  549.    In addition, each of these target machine types can have its own
  550. special options, starting with `-m', to choose among various hardware
  551. models or configurations--for example, 68010 vs 68020, floating
  552. coprocessor or none.  A single installed version of the compiler can
  553. compile for any model or configuration, according to the options
  554. specified.
  555.    Some configurations of the compiler also support additional special
  556. options, usually for compatibility with other compilers on the same
  557. platform.
  558.    These options are defined by the macro `TARGET_SWITCHES' in the
  559. machine description.  The default for the options is also defined by
  560. that macro, which enables you to change the defaults.
  561. * Menu:
  562. * M680x0 Options::
  563. * VAX Options::
  564. * SPARC Options::
  565. * Convex Options::
  566. * AMD29K Options::
  567. * ARM Options::
  568. * M88K Options::
  569. * RS/6000 and PowerPC Options::
  570. * RT Options::
  571. * MIPS Options::
  572. * i386 Options::
  573. * HPPA Options::
  574. * Intel 960 Options::
  575. * DEC Alpha Options::
  576. * Clipper Options::
  577. * H8/300 Options::
  578. * System V Options::
  579. File: gcc.info,  Node: M680x0 Options,  Next: VAX Options,  Up: Submodel Options
  580. M680x0 Options
  581. --------------
  582.    These are the `-m' options defined for the 68000 series.  The default
  583. values for these options depends on which style of 68000 was selected
  584. when the compiler was configured; the defaults for the most common
  585. choices are given below.
  586. `-m68000'
  587. `-mc68000'
  588.      Generate output for a 68000.  This is the default when the
  589.      compiler is configured for 68000-based systems.
  590. `-m68020'
  591. `-mc68020'
  592.      Generate output for a 68020.  This is the default when the
  593.      compiler is configured for 68020-based systems.
  594. `-m68881'
  595.      Generate output containing 68881 instructions for floating point.
  596.      This is the default for most 68020 systems unless `-nfp' was
  597.      specified when the compiler was configured.
  598. `-m68030'
  599.      Generate output for a 68030.  This is the default when the
  600.      compiler is configured for 68030-based systems.
  601. `-m68040'
  602.      Generate output for a 68040.  This is the default when the
  603.      compiler is configured for 68040-based systems.
  604.      This option inhibits the use of 68881/68882 instructions that have
  605.      to be emulated by software on the 68040.  If your 68040 does not
  606.      have code to emulate those instructions, use `-m68040'.
  607. `-m68020-40'
  608.      Generate output for a 68040, without using any of the new
  609.      instructions.  This results in code which can run relatively
  610.      efficiently on either a 68020/68881 or a 68030 or a 68040.  The
  611.      generated code does use the 68881 instructions that are emulated
  612.      on the 68040.
  613. `-mfpa'
  614.      Generate output containing Sun FPA instructions for floating point.
  615. `-msoft-float'
  616.      Generate output containing library calls for floating point.
  617.      *Warning:* the requisite libraries are not part of GNU CC.
  618.      Normally the facilities of the machine's usual C compiler are
  619.      used, but this can't be done directly in cross-compilation.  You
  620.      must make your own arrangements to provide suitable library
  621.      functions for cross-compilation.
  622. `-mshort'
  623.      Consider type `int' to be 16 bits wide, like `short int'.
  624. `-mnobitfield'
  625.      Do not use the bit-field instructions.  The `-m68000' option
  626.      implies `-mnobitfield'.
  627. `-mbitfield'
  628.      Do use the bit-field instructions.  The `-m68020' option implies
  629.      `-mbitfield'.  This is the default if you use a configuration
  630.      designed for a 68020.
  631. `-mrtd'
  632.      Use a different function-calling convention, in which functions
  633.      that take a fixed number of arguments return with the `rtd'
  634.      instruction, which pops their arguments while returning.  This
  635.      saves one instruction in the caller since there is no need to pop
  636.      the arguments there.
  637.      This calling convention is incompatible with the one normally used
  638.      on Unix, so you cannot use it if you need to call libraries
  639.      compiled with the Unix compiler.
  640.      Also, you must provide function prototypes for all functions that
  641.      take variable numbers of arguments (including `printf'); otherwise
  642.      incorrect code will be generated for calls to those functions.
  643.      In addition, seriously incorrect code will result if you call a
  644.      function with too many arguments.  (Normally, extra arguments are
  645.      harmlessly ignored.)
  646.      The `rtd' instruction is supported by the 68010 and 68020
  647.      processors, but not by the 68000.
  648. File: gcc.info,  Node: VAX Options,  Next: SPARC Options,  Prev: M680x0 Options,  Up: Submodel Options
  649. VAX Options
  650. -----------
  651.    These `-m' options are defined for the Vax:
  652. `-munix'
  653.      Do not output certain jump instructions (`aobleq' and so on) that
  654.      the Unix assembler for the Vax cannot handle across long ranges.
  655. `-mgnu'
  656.      Do output those jump instructions, on the assumption that you will
  657.      assemble with the GNU assembler.
  658. `-mg'
  659.      Output code for g-format floating point numbers instead of
  660.      d-format.
  661. File: gcc.info,  Node: SPARC Options,  Next: Convex Options,  Prev: VAX Options,  Up: Submodel Options
  662. SPARC Options
  663. -------------
  664.    These `-m' switches are supported on the SPARC:
  665. `-mno-app-regs'
  666. `-mapp-regs'
  667.      Specify `-mapp-regs' to generate output using the global registers
  668.      2 through 4, which the SPARC SVR4 ABI reserves for applications.
  669.      This is the default.
  670.      To be fully SVR4 ABI compliant at the cost of some performance
  671.      loss, specify `-mno-app-regs'.  You should compile libraries and
  672.      system software with this option.
  673. `-mfpu'
  674. `-mhard-float'
  675.      Generate output containing floating point instructions.  This is
  676.      the default.
  677. `-mno-fpu'
  678. `-msoft-float'
  679.      Generate output containing library calls for floating point.
  680.      *Warning:* there is no GNU floating-point library for SPARC.
  681.      Normally the facilities of the machine's usual C compiler are
  682.      used, but this cannot be done directly in cross-compilation.  You
  683.      must make your own arrangements to provide suitable library
  684.      functions for cross-compilation.
  685.      `-msoft-float' changes the calling convention in the output file;
  686.      therefore, it is only useful if you compile *all* of a program with
  687.      this option.  In particular, you need to compile `libgcc.a', the
  688.      library that comes with GNU CC, with `-msoft-float' in order for
  689.      this to work.
  690. `-mhard-quad-float'
  691.      Generate output containing quad-word (long double) floating point
  692.      instructions.
  693. `-msoft-quad-float'
  694.      Generate output containing library calls for quad-word (long
  695.      double) floating point instructions.  The functions called are
  696.      those specified in the SPARC ABI.  This is the default.
  697.      As of this writing, there are no sparc implementations that have
  698.      hardware support for the quad-word floating point instructions.
  699.      They all invoke a trap handler for one of these instructions, and
  700.      then the trap handler emulates the effect of the instruction.
  701.      Because of the trap handler overhead, this is much slower than
  702.      calling the ABI library routines.  Thus the `-msoft-quad-float'
  703.      option is the default.
  704. `-mno-epilogue'
  705. `-mepilogue'
  706.      With `-mepilogue' (the default), the compiler always emits code for
  707.      function exit at the end of each function.  Any function exit in
  708.      the middle of the function (such as a return statement in C) will
  709.      generate a jump to the exit code at the end of the function.
  710.      With `-mno-epilogue', the compiler tries to emit exit code inline
  711.      at every function exit.
  712. `-mno-flat'
  713. `-mflat'
  714.      With `-mflat', the compiler does not generate save/restore
  715.      instructions and will use a "flat" or single register window
  716.      calling convention.  This model uses %i7 as the frame pointer and
  717.      is compatible with the normal register window model.  Code from
  718.      either may be intermixed although debugger support is still
  719.      incomplete.  The local registers and the input registers (0-5) are
  720.      still treated as "call saved" registers and will be saved on the
  721.      stack as necessary.
  722.      With `-mno-flat' (the default), the compiler emits save/restore
  723.      instructions (except for leaf functions) and is the normal mode of
  724.      operation.
  725. `-mno-unaligned-doubles'
  726. `-munaligned-doubles'
  727.      Assume that doubles have 8 byte alignment.  This is the default.
  728.      With `-munaligned-doubles', GNU CC assumes that doubles have 8 byte
  729.      alignment only if they are contained in another type, or if they
  730.      have an absolute address.  Otherwise, it assumes they have 4 byte
  731.      alignment.  Specifying this option avoids some rare compatibility
  732.      problems with code generated by other compilers.  It is not the
  733.      default because it results in a performance loss, especially for
  734.      floating point code.
  735. `-mv8'
  736. `-msparclite'
  737.      These two options select variations on the SPARC architecture.
  738.      By default (unless specifically configured for the Fujitsu
  739.      SPARClite), GCC generates code for the v7 variant of the SPARC
  740.      architecture.
  741.      `-mv8' will give you SPARC v8 code.  The only difference from v7
  742.      code is that the compiler emits the integer multiply and integer
  743.      divide instructions which exist in SPARC v8 but not in SPARC v7.
  744.      `-msparclite' will give you SPARClite code.  This adds the integer
  745.      multiply, integer divide step and scan (`ffs') instructions which
  746.      exist in SPARClite but not in SPARC v7.
  747. `-mcypress'
  748. `-msupersparc'
  749.      These two options select the processor for which the code is
  750.      optimised.
  751.      With `-mcypress' (the default), the compiler optimizes code for the
  752.      Cypress CY7C602 chip, as used in the SparcStation/SparcSever 3xx
  753.      series.  This is also apropriate for the older SparcStation 1, 2,
  754.      IPX etc.
  755.      With `-msupersparc' the compiler optimizes code for the SuperSparc
  756.      cpu, as used in the SparcStation 10, 1000 and 2000 series. This
  757.      flag also enables use of the full SPARC v8 instruction set.
  758.    In a future version of GCC, these options will very likely be
  759. renamed to `-mcpu=cypress' and `-mcpu=supersparc'.
  760.    These `-m' switches are supported in addition to the above on SPARC
  761. V9 processors:
  762. `-mcode-model=medium-low'
  763.      Generate code for the Medium/Low code model: assume a 32 bit
  764.      address space.  Programs are statically linked, PIC is not
  765.      supported.  Pointers are still 64 bits.
  766. `-mcode-model=medium-anywhere'
  767.      Generate code for the Medium/Anywhere code model: assume a 32 bit
  768.      text segment starting at offset 0, and a 32 bit data segment
  769.      starting anywhere (determined at link time).  Programs are
  770.      statically linked, PIC is not supported.  Pointers are still 64
  771.      bits.
  772. `-mint64'
  773.      Types long and int are 64 bits.
  774. `-mlong32'
  775.      Types long and int are 32 bits.
  776. `-mlong64'
  777. `-mint32'
  778.      Type long is 64 bits, and type int is 32 bits.
  779. `-mstack-bias'
  780. `-mno-stack-bias'
  781.      With `-mstack-bias', GNU CC assumes that the stack pointer, and
  782.      frame pointer if present, are offset by -2047 which must be added
  783.      back when making stack frame references.  Otherwise, assume no
  784.      such offset is present.
  785. File: gcc.info,  Node: Convex Options,  Next: AMD29K Options,  Prev: SPARC Options,  Up: Submodel Options
  786. Convex Options
  787. --------------
  788.    These `-m' options are defined for Convex:
  789. `-mc1'
  790.      Generate output for C1.  The code will run on any Convex machine.
  791.      The preprocessor symbol `__convex__c1__' is defined.
  792. `-mc2'
  793.      Generate output for C2.  Uses instructions not available on C1.
  794.      Scheduling and other optimizations are chosen for max performance
  795.      on C2.  The preprocessor symbol `__convex_c2__' is defined.
  796. `-mc32'
  797.      Generate output for C32xx.  Uses instructions not available on C1.
  798.      Scheduling and other optimizations are chosen for max performance
  799.      on C32.  The preprocessor symbol `__convex_c32__' is defined.
  800. `-mc34'
  801.      Generate output for C34xx.  Uses instructions not available on C1.
  802.      Scheduling and other optimizations are chosen for max performance
  803.      on C34.  The preprocessor symbol `__convex_c34__' is defined.
  804. `-mc38'
  805.      Generate output for C38xx.  Uses instructions not available on C1.
  806.      Scheduling and other optimizations are chosen for max performance
  807.      on C38.  The preprocessor symbol `__convex_c38__' is defined.
  808. `-margcount'
  809.      Generate code which puts an argument count in the word preceding
  810.      each argument list.  This is compatible with regular CC, and a few
  811.      programs may need the argument count word.  GDB and other
  812.      source-level debuggers do not need it; this info is in the symbol
  813.      table.
  814. `-mnoargcount'
  815.      Omit the argument count word.  This is the default.
  816. `-mvolatile-cache'
  817.      Allow volatile references to be cached.  This is the default.
  818. `-mvolatile-nocache'
  819.      Volatile references bypass the data cache, going all the way to
  820.      memory.  This is only needed for multi-processor code that does
  821.      not use standard synchronization instructions.  Making
  822.      non-volatile references to volatile locations will not necessarily
  823.      work.
  824. `-mlong32'
  825.      Type long is 32 bits, the same as type int.  This is the default.
  826. `-mlong64'
  827.      Type long is 64 bits, the same as type long long.  This option is
  828.      useless, because no library support exists for it.
  829. File: gcc.info,  Node: AMD29K Options,  Next: ARM Options,  Prev: Convex Options,  Up: Submodel Options
  830. AMD29K Options
  831. --------------
  832.    These `-m' options are defined for the AMD Am29000:
  833. `-mdw'
  834.      Generate code that assumes the `DW' bit is set, i.e., that byte and
  835.      halfword operations are directly supported by the hardware.  This
  836.      is the default.
  837. `-mndw'
  838.      Generate code that assumes the `DW' bit is not set.
  839. `-mbw'
  840.      Generate code that assumes the system supports byte and halfword
  841.      write operations.  This is the default.
  842. `-mnbw'
  843.      Generate code that assumes the systems does not support byte and
  844.      halfword write operations.  `-mnbw' implies `-mndw'.
  845. `-msmall'
  846.      Use a small memory model that assumes that all function addresses
  847.      are either within a single 256 KB segment or at an absolute
  848.      address of less than 256k.  This allows the `call' instruction to
  849.      be used instead of a `const', `consth', `calli' sequence.
  850. `-mnormal'
  851.      Use the normal memory model: Generate `call' instructions only when
  852.      calling functions in the same file and `calli' instructions
  853.      otherwise.  This works if each file occupies less than 256 KB but
  854.      allows the entire executable to be larger than 256 KB.  This is
  855.      the default.
  856. `-mlarge'
  857.      Always use `calli' instructions.  Specify this option if you expect
  858.      a single file to compile into more than 256 KB of code.
  859. `-m29050'
  860.      Generate code for the Am29050.
  861. `-m29000'
  862.      Generate code for the Am29000.  This is the default.
  863. `-mkernel-registers'
  864.      Generate references to registers `gr64-gr95' instead of to
  865.      registers `gr96-gr127'.  This option can be used when compiling
  866.      kernel code that wants a set of global registers disjoint from
  867.      that used by user-mode code.
  868.      Note that when this option is used, register names in `-f' flags
  869.      must use the normal, user-mode, names.
  870. `-muser-registers'
  871.      Use the normal set of global registers, `gr96-gr127'.  This is the
  872.      default.
  873. `-mstack-check'
  874. `-mno-stack-check'
  875.      Insert (or do not insert) a call to `__msp_check' after each stack
  876.      adjustment.  This is often used for kernel code.
  877. `-mstorem-bug'
  878. `-mno-storem-bug'
  879.      `-mstorem-bug' handles 29k processors which cannot handle the
  880.      separation of a mtsrim insn and a storem instruction (most 29000
  881.      chips to date, but not the 29050).
  882. `-mno-reuse-arg-regs'
  883. `-mreuse-arg-regs'
  884.      `-mno-reuse-arg-regs' tells the compiler to only use incoming
  885.      argument registers for copying out arguments.  This helps detect
  886.      calling a function with fewer arguments than it was declared with.
  887. `-msoft-float'
  888.      Generate output containing library calls for floating point.
  889.      *Warning:* the requisite libraries are not part of GNU CC.
  890.      Normally the facilities of the machine's usual C compiler are
  891.      used, but this can't be done directly in cross-compilation.  You
  892.      must make your own arrangements to provide suitable library
  893.      functions for cross-compilation.
  894. File: gcc.info,  Node: ARM Options,  Next: M88K Options,  Prev: AMD29K Options,  Up: Submodel Options
  895. ARM Options
  896. -----------
  897.    These `-m' options are defined for Advanced RISC Machines (ARM)
  898. architectures:
  899. `-m2'
  900. `-m3'
  901.      These options are identical.  Generate code for the ARM2 and ARM3
  902.      processors.  This option is the default.  You should also use this
  903.      option to generate code for ARM6 processors that are running with a
  904.      26-bit program counter.
  905. `-m6'
  906.      Generate code for the ARM6 processor when running with a 32-bit
  907.      program counter.
  908. `-mapcs'
  909.      Generate a stack frame that is compliant with the ARM Proceedure
  910.      Call Standard for all functions, even if this is not strictly
  911.      necessary for correct execution of the code.
  912. `-mbsd'
  913.      This option only applies to RISC iX.  Emulate the native BSD-mode
  914.      compiler.  This is the default if `-ansi' is not specified.
  915. `-mxopen'
  916.      This option only applies to RISC iX.  Emulate the native
  917.      X/Open-mode compiler.
  918. `-mno-symrename'
  919.      This option only applies to RISC iX.  Do not run the assembler
  920.      post-processor, `symrename', after code has been assembled.
  921.      Normally it is necessary to modify some of the standard symbols in
  922.      preparation for linking with the RISC iX C library; this option
  923.      suppresses this pass.  The post-processor is never run when the
  924.      compiler is built for cross-compilation.
  925.